<template>
    <div id="zheDang"></div>
    <header>
        <div>购物车</div>
        <div id="bianJi" @click="bianJi" v-if="block">
            <span>编辑</span>
        </div>
        <div id="wanCheng" @click="wanCheng" v-else>
            <span>完成</span>
        </div>
    </header>
</template>

<script>
    export default {
        name: "ShopCartHeaderCom",
        data(){
            return{
                block:true
            }
        },
        methods:{
            bianJi(){
                this.block = false
                this.$store.dispatch('blockNone',this.block)
            },
            wanCheng(){
                this.block = true
                this.$store.dispatch('blockNone',this.block)
            }
        }
    }
</script>

<style scoped>
    #zheDang{
        width: 100%;
        height: 46px;
    }
    header{
        width: 100%;
        height: 45px;
        position: fixed;
        top: 0;
        border-bottom: 1px solid lightgrey;
        display: flex;
        justify-content: space-between;
    }
    header>div{
        font-size: 20px;
        line-height: 45px;
        margin-left: 10px;
    }
    header span{
        font-size: 16px;
        line-height: 45px;
        margin-right: 10px;
    }
    #bianJi{
        position: absolute;
        right: 0;
    }
</style>